package org.gap.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Calendar;
import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */
@IdClass(org.gap.domain.AdressesTiersPK.class)
@Entity
@NamedQueries({
		@NamedQuery(name = "findAdressesTiersByAdtAdresse", query = "select myAdressesTiers from AdressesTiers myAdressesTiers where myAdressesTiers.adtAdresse = ?1"),
		@NamedQuery(name = "findAdressesTiersByAdtDateCreation", query = "select myAdressesTiers from AdressesTiers myAdressesTiers where myAdressesTiers.adtDateCreation = ?1"),
		@NamedQuery(name = "findAdressesTiersByAdtDateCreationAfter", query = "select myAdressesTiers from AdressesTiers myAdressesTiers where myAdressesTiers.adtDateCreation > ?1"),
		@NamedQuery(name = "findAdressesTiersByAdtDateCreationBefore", query = "select myAdressesTiers from AdressesTiers myAdressesTiers where myAdressesTiers.adtDateCreation < ?1"),
		@NamedQuery(name = "findAdressesTiersByAdtDateModification", query = "select myAdressesTiers from AdressesTiers myAdressesTiers where myAdressesTiers.adtDateModification = ?1"),
		@NamedQuery(name = "findAdressesTiersByAdtDateModificationAfter", query = "select myAdressesTiers from AdressesTiers myAdressesTiers where myAdressesTiers.adtDateModification > ?1"),
		@NamedQuery(name = "findAdressesTiersByAdtDateModificationBefore", query = "select myAdressesTiers from AdressesTiers myAdressesTiers where myAdressesTiers.adtDateModification < ?1"),
		@NamedQuery(name = "findAdressesTiersByAdtEtatAffectation", query = "select myAdressesTiers from AdressesTiers myAdressesTiers where myAdressesTiers.adtEtatAffectation = ?1"),
		@NamedQuery(name = "findAdressesTiersByAdtEtatAffectationContaining", query = "select myAdressesTiers from AdressesTiers myAdressesTiers where myAdressesTiers.adtEtatAffectation like ?1"),
		@NamedQuery(name = "findAdressesTiersByAdtFinAffectation", query = "select myAdressesTiers from AdressesTiers myAdressesTiers where myAdressesTiers.adtFinAffectation = ?1"),
		@NamedQuery(name = "findAdressesTiersByAdtFinAffectationAfter", query = "select myAdressesTiers from AdressesTiers myAdressesTiers where myAdressesTiers.adtFinAffectation > ?1"),
		@NamedQuery(name = "findAdressesTiersByAdtFinAffectationBefore", query = "select myAdressesTiers from AdressesTiers myAdressesTiers where myAdressesTiers.adtFinAffectation < ?1"),
		@NamedQuery(name = "findAdressesTiersByAdtTiers", query = "select myAdressesTiers from AdressesTiers myAdressesTiers where myAdressesTiers.adtTiers = ?1"),
		@NamedQuery(name = "findAdressesTiersByAdtTypeAdresse", query = "select myAdressesTiers from AdressesTiers myAdressesTiers where myAdressesTiers.adtTypeAdresse = ?1"),
		@NamedQuery(name = "findAdressesTiersByAdtTypeAdresseContaining", query = "select myAdressesTiers from AdressesTiers myAdressesTiers where myAdressesTiers.adtTypeAdresse like ?1"),
		@NamedQuery(name = "findAdressesTiersByPrimaryKey", query = "select myAdressesTiers from AdressesTiers myAdressesTiers where myAdressesTiers.adtAdresse = ?1 and myAdressesTiers.adtTiers = ?2 and myAdressesTiers.adtTypeAdresse = ?3 and myAdressesTiers.adtEtatAffectation = ?4 and myAdressesTiers.adtFinAffectation = ?5"),
		@NamedQuery(name = "findAllAdressesTierss", query = "select myAdressesTiers from AdressesTiers myAdressesTiers") })
@Table(schema = "GAP", name = "ADRESSES_TIERS")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "GAP_v2/org/gap/domain", name = "AdressesTiers")
public class AdressesTiers implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "ADT_ADRESSE", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer adtAdresse;
	/**
	 */

	@Column(name = "ADT_TIERS", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer adtTiers;
	/**
	 */

	@Column(name = "ADT_TYPE_ADRESSE", length = 10, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	String adtTypeAdresse;
	/**
	 */

	@Column(name = "ADT_ETAT_AFFECTATION", length = 1, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	String adtEtatAffectation;
	/**
	 */
	@Temporal(TemporalType.DATE)
	@Column(name = "ADT_FIN_AFFECTATION", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Calendar adtFinAffectation;
	/**
	 */
	@Temporal(TemporalType.DATE)
	@Column(name = "ADT_DATE_CREATION")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Calendar adtDateCreation;
	/**
	 */
	@Temporal(TemporalType.DATE)
	@Column(name = "ADT_DATE_MODIFICATION")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Calendar adtDateModification;

	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "ADT_USER_MODIFICATION", referencedColumnName = "USR_USER") })
	@XmlTransient
	Utilisateurs utilisateursByAdtUserModification;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "ADT_USER_CREATION", referencedColumnName = "USR_USER") })
	@XmlTransient
	Utilisateurs utilisateursByAdtUserCreation;

	/**
	 */
	public void setAdtAdresse(Integer adtAdresse) {
		this.adtAdresse = adtAdresse;
	}

	/**
	 */
	public Integer getAdtAdresse() {
		return this.adtAdresse;
	}

	/**
	 */
	public void setAdtTiers(Integer adtTiers) {
		this.adtTiers = adtTiers;
	}

	/**
	 */
	public Integer getAdtTiers() {
		return this.adtTiers;
	}

	/**
	 */
	public void setAdtTypeAdresse(String adtTypeAdresse) {
		this.adtTypeAdresse = adtTypeAdresse;
	}

	/**
	 */
	public String getAdtTypeAdresse() {
		return this.adtTypeAdresse;
	}

	/**
	 */
	public void setAdtEtatAffectation(String adtEtatAffectation) {
		this.adtEtatAffectation = adtEtatAffectation;
	}

	/**
	 */
	public String getAdtEtatAffectation() {
		return this.adtEtatAffectation;
	}

	/**
	 */
	public void setAdtFinAffectation(Calendar adtFinAffectation) {
		this.adtFinAffectation = adtFinAffectation;
	}

	/**
	 */
	public Calendar getAdtFinAffectation() {
		return this.adtFinAffectation;
	}

	/**
	 */
	public void setAdtDateCreation(Calendar adtDateCreation) {
		this.adtDateCreation = adtDateCreation;
	}

	/**
	 */
	public Calendar getAdtDateCreation() {
		return this.adtDateCreation;
	}

	/**
	 */
	public void setAdtDateModification(Calendar adtDateModification) {
		this.adtDateModification = adtDateModification;
	}

	/**
	 */
	public Calendar getAdtDateModification() {
		return this.adtDateModification;
	}

	/**
	 */
	public void setUtilisateursByAdtUserModification(Utilisateurs utilisateursByAdtUserModification) {
		this.utilisateursByAdtUserModification = utilisateursByAdtUserModification;
	}

	/**
	 */
	public Utilisateurs getUtilisateursByAdtUserModification() {
		return utilisateursByAdtUserModification;
	}

	/**
	 */
	public void setUtilisateursByAdtUserCreation(Utilisateurs utilisateursByAdtUserCreation) {
		this.utilisateursByAdtUserCreation = utilisateursByAdtUserCreation;
	}

	/**
	 */
	public Utilisateurs getUtilisateursByAdtUserCreation() {
		return utilisateursByAdtUserCreation;
	}

	/**
	 */
	public AdressesTiers() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(AdressesTiers that) {
		setAdtAdresse(that.getAdtAdresse());
		setAdtTiers(that.getAdtTiers());
		setAdtTypeAdresse(that.getAdtTypeAdresse());
		setAdtEtatAffectation(that.getAdtEtatAffectation());
		setAdtFinAffectation(that.getAdtFinAffectation());
		setAdtDateCreation(that.getAdtDateCreation());
		setAdtDateModification(that.getAdtDateModification());
		setUtilisateursByAdtUserModification(that.getUtilisateursByAdtUserModification());
		setUtilisateursByAdtUserCreation(that.getUtilisateursByAdtUserCreation());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("adtAdresse=[").append(adtAdresse).append("] ");
		buffer.append("adtTiers=[").append(adtTiers).append("] ");
		buffer.append("adtTypeAdresse=[").append(adtTypeAdresse).append("] ");
		buffer.append("adtEtatAffectation=[").append(adtEtatAffectation).append("] ");
		buffer.append("adtFinAffectation=[").append(adtFinAffectation).append("] ");
		buffer.append("adtDateCreation=[").append(adtDateCreation).append("] ");
		buffer.append("adtDateModification=[").append(adtDateModification).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((adtAdresse == null) ? 0 : adtAdresse.hashCode()));
		result = (int) (prime * result + ((adtTiers == null) ? 0 : adtTiers.hashCode()));
		result = (int) (prime * result + ((adtTypeAdresse == null) ? 0 : adtTypeAdresse.hashCode()));
		result = (int) (prime * result + ((adtEtatAffectation == null) ? 0 : adtEtatAffectation.hashCode()));
		result = (int) (prime * result + ((adtFinAffectation == null) ? 0 : adtFinAffectation.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof AdressesTiers))
			return false;
		AdressesTiers equalCheck = (AdressesTiers) obj;
		if ((adtAdresse == null && equalCheck.adtAdresse != null) || (adtAdresse != null && equalCheck.adtAdresse == null))
			return false;
		if (adtAdresse != null && !adtAdresse.equals(equalCheck.adtAdresse))
			return false;
		if ((adtTiers == null && equalCheck.adtTiers != null) || (adtTiers != null && equalCheck.adtTiers == null))
			return false;
		if (adtTiers != null && !adtTiers.equals(equalCheck.adtTiers))
			return false;
		if ((adtTypeAdresse == null && equalCheck.adtTypeAdresse != null) || (adtTypeAdresse != null && equalCheck.adtTypeAdresse == null))
			return false;
		if (adtTypeAdresse != null && !adtTypeAdresse.equals(equalCheck.adtTypeAdresse))
			return false;
		if ((adtEtatAffectation == null && equalCheck.adtEtatAffectation != null) || (adtEtatAffectation != null && equalCheck.adtEtatAffectation == null))
			return false;
		if (adtEtatAffectation != null && !adtEtatAffectation.equals(equalCheck.adtEtatAffectation))
			return false;
		if ((adtFinAffectation == null && equalCheck.adtFinAffectation != null) || (adtFinAffectation != null && equalCheck.adtFinAffectation == null))
			return false;
		if (adtFinAffectation != null && !adtFinAffectation.equals(equalCheck.adtFinAffectation))
			return false;
		return true;
	}
}
